// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const env = "fz-xiaochengxu-3ggm49cn525bedba";
const db = cloud.database({env});

// 云函数入口函数
exports.main = async (event, context) => {
    db.collection("encounters").add({
        data: {
          imagePath:event.imagePath,
          _id:event._id,
          content: event.postText,
          location:db.Geo.Point(event.location.longitude,event.location.latitude),
          _openid: event.openid,
          tag:event.tag,
          address:event.address,
          date:db.serverDate(),
          name:event.name
        }
    })
}
